package com.simtop.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.simtop.dao.ExperimentMapper;
import com.simtop.expection.GlobalException;
import com.simtop.pojo.u3dpo.Ud;
import com.simtop.pojo.u3dpo.Uds;
import com.simtop.pojo.experimentpo.Experiment;
import com.simtop.pojo.experimentpo.ExperimentDynamicVo;
import com.simtop.pojo.experimentpo.ExperimentReportVo;
import com.simtop.service.ExperimentService;
import com.simtop.util.htmlutil.EscapeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class ExperimentServiceImpl implements ExperimentService {

    @Autowired
    private ExperimentMapper experimentMapper;


    /**
     * 添加实验报告
     *
     * @param experiment
     * @return
     */
    @Override
    public boolean insertExperiment(Experiment experiment) {
        return experimentMapper.insertExperiment(experiment);
    }


    /**
     * 修改实验报告
     *
     * @param experiment
     * @return
     */
    @Override
    public boolean updateExperiment(Experiment experiment) {
        return experimentMapper.updateExperiment(experiment);
    }

    /**
     * 作品动态列表
     *
     * @param message 关键字
     * @return
     */
    @Override
    public List<ExperimentDynamicVo> getAllDynamic(String message) {
        return experimentMapper.getAllDynamic(message);
    }

    /**
     * 获取实验报告列表
     *
     * @param userId
     * @param message 关键字
     * @return
     */
    @Override
    public List<ExperimentReportVo> getAllReport(Integer userId, String message) {
        return experimentMapper.getAllReport(userId, message);
    }

    /**
     * 点赞
     *
     * @param userId
     * @param experimentId
     * @return
     */
    @Override
    public boolean giveLike(Integer userId, Long experimentId) {
        return experimentMapper.giveLike(userId, experimentId);
    }

    /**
     * 取消点赞
     *
     * @param userId
     * @param experimentId
     * @return
     */
    @Override
    public boolean unGiveLike(Integer userId, Long experimentId) {
        return experimentMapper.unGiveLike(userId, experimentId);
    }

    /**
     * 删除实验报告
     *
     * @param experimentId
     * @return
     */
    @Override
    public boolean delete(Long experimentId) {
        return experimentMapper.delete(experimentId);
    }

    @Override
    public List<Ud> allsy(int userid) {
        return null;
    }

    @Override
    public List<Ud> allallsy() {
        return null;
    }


    @Override
    public void addu3d02(int id, String username, String data, String formatdata) {
        experimentMapper.addu3d02(id, username, data, formatdata);
    }

    @Override
    public List<Uds> allsy2(int userid) {
        return experimentMapper.allsy2(userid);
    }

    @Override
    public List<Uds> allallsy02() {
        return experimentMapper.allallsy02();
    }

    @Override
    public void deleteExperimental(Integer udsid) {
        experimentMapper.deleteExperimental(udsid);
    }

    @Override
    public void addu3ddddd(int id, String username, String userTime, String conmmitTime,
                           Integer totalScore, Integer score_read, Integer score_sigin,
                           Integer score_begin, Integer score_zt, Integer score_jzcf, Integer score_zts, Integer score_fac,
                           Integer score_hy, Integer score_wy, Integer score_kh, String qd_summary, String yj_summary, String hy_summary, String wy_summary) {

        experimentMapper.addu3ddddd(id, username, userTime, conmmitTime, totalScore, score_read, score_sigin, score_begin, score_zt,
                score_jzcf, score_zts, score_fac, score_hy, score_wy, score_kh, qd_summary, yj_summary, hy_summary, wy_summary);

    }
}
